package com.lc202310;

import java.util.HashMap;
import java.util.Map;

/**
 * Description:
 *
 * @Create 2023/10/16 21:49
 * @Version 1.0
 */
public class Solution260 {
    public int[] singleNumber(int[] nums) {
        Map<Integer, Integer> map = new HashMap<>();
        for (int num : nums) {
            int tmp = map.getOrDefault(num, 0) + 1;
            if (tmp == 2) {
                map.remove(num);
                continue;
            }
            map.put(num, tmp);
        }
        Integer[] arr = map.keySet().toArray(new Integer[0]);
        return new int[]{arr[0], arr[1]};
    }
}
